/*
 * Created on Jun 6, 2005
 *
 */
package com.erclab.internal.xpresso.repositories;

import java.util.*;

import com.erclab.internal.xpresso.dataAccess.*;
import com.erclab.internal.xpresso.dataAccess.ApplicationDataSource;
import com.erclab.internal.xpresso.dataAccess.DAOFactory;
import com.erclab.internal.xpresso.exceptions.RepositoryException;

/**
 * @author Enrique Rodriguez.
 *
 */
public class FlatFileRepository extends Repository {

	private String pathToRepository;
	private PropertyResourceBundle properties;
	
	private void loadConfiguration() throws RepositoryException {

		properties = (PropertyResourceBundle) ResourceBundle.getBundle("class name");
				
		if (properties == null)
			throw new RepositoryException("The properties com.erclab.internal.xpresso.repositories.FlatFileRepository could not be found");
	}
	
	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.repositories.Repository#getApplicationDataSource(int)
	 */
	public ApplicationDataSource getApplicationDataSource(int idDataSource) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.repositories.Repository#getDaoFactory()
	 */
	public DAOFactory getDaoFactory(){
		return new FlatFileDAOFactory();
	}

	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.repositories.Repository#getRepositoryDataSource()
	 */
	public Object getRepositoryDataSource() {
		return pathToRepository;
	}

	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.repositories.Repository#setup()
	 */
	public void setup() throws RepositoryException {
		loadConfiguration();
		this.pathToRepository = (String)properties.getObject("pathToRepository");
	}

	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.repositories.Repository#getRepositoryDataSource(java.lang.String)
	 */
	public Object getRepositoryDataSource(String objectName) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.repositories.Repository#getApplicationDataSource(java.lang.String)
	 */
	public ApplicationDataSource getApplicationDataSource(String dataSourceName) {
		// TODO Auto-generated method stub
		return null;
	}

}
